package com.icangya.DAO.impl;

import com.icangya.DAO.IAdminDAO;
import com.icangya.DAO.IAgentImageDAO;
import com.icangya.Utils.SQLUtilt;
import com.icangya.domain.Admin;
import com.icangya.domain.AgentImage;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.orm.hibernate5.HibernateCallback;
import org.springframework.stereotype.Repository;

import java.util.List;

import static com.icangya.Value.StaticValue.PHONE_PAGE_ROW;

@Repository
public class AgentImageDAOImpl extends  BaseDAO<AgentImage> implements IAgentImageDAO {

    Logger logger = LoggerFactory.getLogger(this.getClass());


    @Override
    public AgentImage getAgentImageByAgentId(long agentId) {
        String hql="from AgentImage ai where ai.agentId=?";
        List list=getHibernateTemplate().find(hql,agentId);
        if(list.size()>0)
            return (AgentImage) list.get(0);
        return null;
    }
}
